$(function(){
	var start1 = {
        elem: "#bdate1",
        format: 'YYYY-MM-DD',
        max: '2099-06-16 23:59:59',
        istime: false,
        istoday: false,
        choose: function(datas) {
            end1.min = datas; //开始日选好后，重置结束日的最小日期
            end1.start = datas //将结束日的初始值设定为开始日
        }
    };
    var end1 = {
        elem: '#fdate1',
        format: 'YYYY-MM-DD',
        //	  min: laydate.now(),
        max: '2099-06-16 23:59:59',
        istime: false,
        istoday: false,
        choose: function(datas) {
            start1.max = datas; //结束日选好后，重置开始日的最大日期
        }
    };
    laydate(start1);
    laydate(end1);
    var start2 = {
        elem: "#bdate2",
        format: 'YYYY-MM-DD',
        max: '2099-06-16 23:59:59',
        istime: false,
        istoday: false,
        choose: function(datas) {
            end2.min = datas; //开始日选好后，重置结束日的最小日期
            end2.start = datas //将结束日的初始值设定为开始日
        }
    };
    var end2 = {
        elem: '#fdate2',
        format: 'YYYY-MM-DD',
        //	  min: laydate.now(),
        max: '2099-06-16 23:59:59',
        istime: false,
        istoday: false,
        choose: function(datas) {
            start2.max = datas; //结束日选好后，重置开始日的最大日期
        }
    };
    laydate(start2);
    laydate(end2);
    var start3 = {
        elem: "#bdate3",
        format: 'YYYY-MM-DD',
        max: '2099-06-16 23:59:59',
        istime: false,
        istoday: false,
        choose: function(datas) {
            end3.min = datas; //开始日选好后，重置结束日的最小日期
            end3.start = datas //将结束日的初始值设定为开始日
        }
    };
    var end3 = {
        elem: '#fdate3',
        format: 'YYYY-MM-DD',
        //	  min: laydate.now(),
        max: '2099-06-16 23:59:59',
        istime: false,
        istoday: false,
        choose: function(datas) {
            start3.max = datas; //结束日选好后，重置开始日的最大日期
        }
    };
    laydate(start3);
    laydate(end3);
    var start4 = {
        elem: "#bdate4",
        format: 'YYYY-MM-DD',
        max: '2099-06-16 23:59:59',
        istime: false,
        istoday: false,
        choose: function(datas) {
            end4.min = datas; //开始日选好后，重置结束日的最小日期
            end4.start = datas //将结束日的初始值设定为开始日
        }
    };
    var end4 = {
        elem: '#fdate4',
        format: 'YYYY-MM-DD',
        //	  min: laydate.now(),
        max: '2099-06-16 23:59:59',
        istime: false,
        istoday: false,
        choose: function(datas) {
            start4.max = datas; //结束日选好后，重置开始日的最大日期
        }
    };
    laydate(start4);
    laydate(end4);
	var mychart = echarts.init(document.getElementById("inspection-pie"));
	mychart.setOption({
		tooltip: {
			trigger: 'item',
			formatter: "{a} <br/>{b}: {c} ({d}%)"
		},
		legend: {
			orient: 'horizontal',
			bottom:"10px",
//			x: 'center',
			itemWidth:8,
			data: [{
				name:'正常',
				icon:'circle'
			},{
				name:'异常',
				icon:'circle'
			},{
				name:'严重',
				icon:'circle'
			}]
		},
		series: [{
			name: '点巡检',
			type: 'pie',
			radius: ['50%', '70%'],
			center:['50%','50%'],
			avoidLabelOverlap: false,
			label: {
				normal: {
					show: true,
					position: 'inside',//内部显示
					formatter:function(param){
						return Math.round(param.percent)+"%";//取整数
					},
				}
			},
			labelLine: {
				normal: {
					show: false
				}
			},
			data: [{
					value: 335,
					name: '正常'
				},
				{
					value: 310,
					name: '异常'
				},
				{
					value: 234,
					name: '严重'
				}
			],
			color:[
				"#56c0a6","#f98b4b","#f74d4c"
			]
		}]
	});
	var mychart2 = echarts.init(document.getElementById("workTicket"));
	mychart2.setOption({
		tooltip: {
			trigger: 'item',
			formatter: "{a} <br/>{b}: {c} ({d}%)"
		},
		legend: {
			orient: 'horizontal',
			bottom:"10px",
//			x: 'center',
			itemWidth:8,
			data: [{
				name:'已完成',
				icon:'circle'
			},{
				name:'未完成',
				icon:'circle'
			}]
		},
		series: [{
			name: '工作票',
			type: 'pie',
			radius: ['50%', '70%'],
			center:['50%','50%'],
			avoidLabelOverlap: false,
			label: {
				normal: {
					show: true,
					position: 'inside',//内部显示
					formatter:function(param){
						return Math.round(param.percent)+"%";//取整数
					},
				}
			},
			labelLine: {
				normal: {
					show: false
				}
			},
			data: [{
					value: 335,
					name: '已完成'
				},
				{
					value: 310,
					name: '未完成'
				}
			],
			color:[
				"#56c0a6","#f98b4b","#f74d4c"
			]
		}]
	});
	var mychart3 = echarts.init(document.getElementById("operation"));
	mychart3.setOption({
		tooltip: {
			trigger: 'item',
			formatter: "{a} <br/>{b}: {c} ({d}%)"
		},
		legend: {
			orient: 'horizontal',
			bottom:"10px",
//			x: 'center',
			itemWidth:8,
			data: [{
				name:'已完成',
				icon:'circle'
			},{
				name:'未完成',
				icon:'circle'
			}]
		},
		series: [{
			name: '操作票',
			type: 'pie',
			radius: ['50%', '70%'],
			center:['50%','50%'],
			avoidLabelOverlap: false,
			label: {
				normal: {
					show: true,
					position: 'inside',//内部显示
					formatter:function(param){
						return Math.round(param.percent)+"%";//取整数
					},
				}
			},
			labelLine: {
				normal: {
					show: false
				}
			},
			data: [{
					value: 335,
					name: '已完成'
				},
				{
					value: 310,
					name: '未完成'
				}
			],
			color:[
				"#56c0a6","#f98b4b","#f74d4c"
			]
		}]
	});
	var mychart4 = echarts.init(document.getElementById("regular"));
	mychart4.setOption({
		tooltip: {
			trigger: 'item',
			formatter: "{a} <br/>{b}: {c} ({d}%)"
		},
		legend: {
			orient: 'horizontal',
			bottom:"10px",
//			x: 'center',
			itemWidth:8,
			data: [{
				name:'已完成',
				icon:'circle'
			},{
				name:'未完成',
				icon:'circle'
			}]
		},
		series: [{
			name: '定期工作',
			type: 'pie',
			radius: ['50%', '70%'],
			center:['50%','50%'],
			avoidLabelOverlap: false,
			label: {
				normal: {
					show: true,
					position: 'inside',//内部显示
					formatter:function(param){
						return Math.round(param.percent)+"%";//取整数
					},
				}
			},
			labelLine: {
				normal: {
					show: false
				}
			},
			data: [{
					value: 335,
					name: '已完成'
				},
				{
					value: 310,
					name: '未完成'
				}
			],
			color:[
				"#56c0a6","#f98b4b","#f74d4c"
			]
		}]
	});
})
